<template>
    <div>
        <ExtForm ref="ExtForm" :formfields="formfields" @changeEventHandler="changeEventHandler" @clickEventHandler="clickEventHandler"></ExtForm>
        
    </div>
</template>
<script>

import pageSetting from '@/components/lt/codeGenerator/pageSetting'
import Vue from 'vue'
import ExtForm from '@/components/lt/codeGenerator/components/ExtForm'
import flowSetting from './flowSetting'
import defaultSettings from '@/config/defaultSettings'
import LAceEditor from '@/components/lt/LAceEditor'

export default {
    name:'edgeAttribute',
    components:{ExtForm,LAceEditor},
    props:{
        attribute:{
           type:Object,
           default:()=>{}
        },
    },
    watch:{
        
    },
    data(){
        return{
            pageSetting,
            formfields:[
                {field:'id',label:'内码',component:pageSetting.常量.表单组件类型.单行文本,initialValue:this.attribute.id,disabled:true},
                {field:'type',label:'类型',component:pageSetting.常量.表单组件类型.单行文本,initialValue:this.attribute.type,disabled:true},
                {field:'label',label:'名称',component:pageSetting.常量.表单组件类型.单行文本,initialValue:this.attribute.label,rules: [{ required: true, message: '不能为空!' }]},
                {field:'isReturn',label:'是否返回',component:pageSetting.常量.表单组件类型.单选框,initialValue:this.attribute.isReturn || '0',options:flowSetting.dict.isReturn,rules: [{ required: true, message: '不能为空!' }]},

                {field:'condition',label:'跳转条件',component:pageSetting.常量.表单组件类型.多行文本,initialValue:this.attribute.condition || '',rules: [{ required: false, message: '不能为空!' }]},

                
            ],
           
           
        }
    },
   
    created(){
        this.initAttribute()
    },
    methods:{
        initAttribute(){
            if(!this.attribute["condition"]){
                this.attribute["condition"]=''
            }
            if(!this.attribute["isReturn"]){
                this.attribute["isReturn"]='0'
            }
        },
        changeEventHandler(item){
            for (const key in item) {
                this.attribute[key]=item[key]
            }
            this.$emit("changeEventHandler",item)
            
        },
      
        clickEventHandler(field,form){
           
            
        }
        
    }
}
</script>